/*
Navicat SQL Server Data Transfer

Source Server         : LOCALHOST
Source Server Version : 110000
Source Host           : .:1433
Source Database       : AAACHAM2
Source Schema         : dbo

Target Server Type    : SQL Server
Target Server Version : 110000
File Encoding         : 65001

Date: 2014-04-29 18:07:46
*/


-- ----------------------------
-- Table structure for tb2554
-- ----------------------------
DROP TABLE [dbo].[tb2554]
GO
CREATE TABLE [dbo].[tb2554] (
[EmployeeID] varchar(20) NOT NULL ,
[Orders] varchar(20) NOT NULL DEFAULT ((0)) ,
[DivisionID] varchar(20) NULL ,
[DepartmentID] varchar(20) NULL ,
[TeamID] varchar(20) NULL ,
[LastName] nvarchar(50) NULL ,
[MiddleName] nvarchar(50) NULL ,
[FirstName] nvarchar(50) NULL ,
[ShortName] nvarchar(50) NULL ,
[Alias] nvarchar(50) NULL ,
[Birthday] varchar(10) NULL ,
[BornPlace] nvarchar(250) NULL ,
[IsMale] tinyint NULL DEFAULT ((0)) ,
[NativeCountry] nvarchar(250) NULL ,
[PermanentAddress] nvarchar(250) NULL ,
[TemporaryAddress] nvarchar(250) NULL ,
[PassportNo] varchar(50) NULL ,
[PassportDate] datetime NULL ,
[PassportEnd] datetime NULL ,
[IdentifyCardNo] varchar(50) NULL ,
[IdentifyDate] datetime NULL ,
[IdentifyPlace] nvarchar(250) NULL ,
[IsSingle] tinyint NOT NULL DEFAULT ((0)) ,
[ImageID] image NULL ,
[CountryID] varchar(20) NULL ,
[CityID] varchar(20) NULL ,
[DistrictID] varchar(20) NULL ,
[EthnicID] varchar(20) NULL ,
[ReligionID] varchar(20) NULL ,
[Notes] nvarchar(250) NULL ,
[HealthStatus] nvarchar(250) NULL ,
[HomePhone] varchar(50) NULL ,
[HomeFax] varchar(50) NULL ,
[MobiPhone] varchar(50) NULL ,
[Email] varchar(100) NULL ,
[CreateDate] datetime NULL ,
[CreateUserID] varchar(20) NULL ,
[LastModifyDate] datetime NULL ,
[LastModifyUserID] varchar(20) NULL ,
[S1] varchar(20) NULL ,
[S2] varchar(20) NULL ,
[S3] varchar(20) NULL ,
[EmployeeStatus] tinyint NULL ,
[IsForeigner] tinyint NULL DEFAULT ((0)) ,
[RecruitTimeID] varchar(20) NULL 
)


GO

-- ----------------------------
-- Indexes structure for table tb2554
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table tb2554
-- ----------------------------
ALTER TABLE [dbo].[tb2554] ADD PRIMARY KEY NONCLUSTERED ([EmployeeID])
GO

-- ----------------------------
-- Triggers structure for table tb2554
-- ----------------------------
--DROP TRIGGER [dbo].[HY1400]
GO
CREATE TRIGGER [dbo].[HY1400]
ON [dbo].[tb2554]
AFTER DELETE
AS

Delete tb2545 
FROM tb2545 inner join DELETED DEL On DEL.EmployeeID = tb2545.EmployeeID

Delete tb2559 
From tb2559 inner join DELETED DEL On DEL.EmployeeID = tb2559.EmployeeID

Delete tb2558 
From tb2558  inner join DELETED DEL On DEL.EmployeeID = tb2558.EmployeeID

Delete tb2557
From tb2557  inner join DELETED DEL On DEL.EmployeeID = tb2557.EmployeeID
					and DEL.DivisionID = tb2557.DivisionID

Delete tb2556
From tb2556  inner join DELETED DEL On DEL.EmployeeID = tb2556.EmployeeID
					and DEL.DivisionID = tb2556.DivisionID

Delete tb2555
From tb2555  inner join DELETED DEL On DEL.EmployeeID = tb2555.EmployeeID
					and DEL.DivisionID = tb2555.DivisionID



GO
